import request from '../../utils/request.js'

// 机器翻译
export function machineTranslate(text,from,to){
    return request({
        url: '/aiChat/machineTranslate?text=' + text + '&from=' + from + '&to=' + to,
        method: 'get'
    })
}

// 当完成机器翻译后 获取由ai推荐的相关单词
export function getAiRecommendWord(text,from,to) {
    return request({
        url: '/aiChat/getAiRecommendWord?text=' + text + '&from=' + from + '&to=' + to,
        method: 'get'
    })
}

// ai根据用户输入文本进行纠错
export function aiCorrectionError(text) {
    return request({
        url: '/aiChat/aiCorrectionError?text=' + text,
        method: 'get'
    })
}

// 图片转文字
export function characterRecognition(uid) {
    return request({
        url: '/aiChat/characterRecognition?UID=' + uid,
        method: 'get'
    })
}

// 图片转公式
export function formulaRecognition(uid) {
    return request({
        url: '/aiChat/formulaRecognition?UID=' + uid,
        method: 'get',
    })
}

// 图片转换为电子稿
export function pictureDocument(uid,type,encoding) {
    return request({
        url: '/aiChat/pictureDocument?UID=' + uid + '&type=' + type + '&encoding=' + encoding,
        method: 'get'
    })
}

// 将用户麦克风说的内容传给后端
export function uploadAudioFile(form) {
    return request({
        headers:{ "Content-Type":"multipart/form-data" },
        url: '/aiChat/speechAssessment',
        method: 'post',
        data: form,
    })
}

// 语音评测点击更换题目
export function getRandomSpeechText(category) {
    return request({
        url: '/aiChat/getRandomSpeechText?category=' + category,
        method: 'get'
    })
}

// 拍照速算 返回公式在图上位置并判断结果是否正确
export function photoCalculate(uid) {
    return request({
        url: '/aiChat/photoCalculate?UID=' + uid,
        method: 'get'
    })
}

// 根据uid获取图片的base64链接
export function getBase64LinkByUID(uid) {
    return request({
        url: '/aiChat/getBase64LinkByUID?UID=' + uid,
        method: 'get'
    })
}

// ai文本改写
export function aiTextRewrite(text,level) {
    return request({
        url: '/aiChat/aiTextRewrite?text=' + text + '&level=' + level,
        method: 'get'
    })
}

// 获取用户当天对各个功能的调用频率
export function getToolFrequency() {
    return request({
        url: '/aiChat/getToolFrequency',
        method: 'get'
    })
}

// 更新用户当天使用某个功能的频率
export function updateToolFrequency(idx) {
    return request({
        url: '/aiChat/updateToolFrequency?idx=' + idx,
        method: 'put'
    })
}

// 获取ppt可生成的主题
export function getPptTheme() {
    return request({
        url: '/aiChat/getAiPPTInfo',
        method: 'get'
    })
}

// 获取ai生成的ppt链接
export function getAiPPTLink(type,author,query,isCardNote,isCoverImg,theme) {
    return request({
        url: '/aiChat/getAiPPTWithoutAnything?type=' + type + '&author=' + author + '&query=' + query + '&isCardNote=' + isCardNote + '&isCoverImg=' + isCoverImg + '&theme=' + theme,
        method: 'get'
    })
}